<template>
  <div>
    <h4>兄弟组件传值</h4>
    <p>接收到的兄弟组件的数据：{{ a }} - {{ typeof a }}</p>
    <Grandson />
    ---
  </div>
</template>

<script setup>

import Grandson from "./Grandson.vue";

import bus from "../assets/bus.js"
import {ref} from "vue"

const a = ref(null);

// 借助中央事件总线，绑定自定义事件，准备用来接收兄弟组件的数据
bus.on("qwe", (v)=>{
  console.log(v)
  a.value = v;
})

</script>